Skip to content

feat(BA-6626): app_config_fragment bulk repository layer#12426

Merged
HyeockJinKim merged 1 commit into
mainfrom
feat/BA-6626-app-config-fragment-bulk-repository
Jul 7, 2026
Merged

feat(BA-6626): app_config_fragment bulk repository layer#12426
HyeockJinKim merged 1 commit into
mainfrom
feat/BA-6626-app-config-fragment-bulk-repository

Conversation

@jopemachine

@jopemachine jopemachine commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

Repository-layer app_config_fragment bulk operations, split out of #12401 (BA-6618) to keep that PR reviewable. No API/service surface here — the service layer stacks on top. Built on the generic partial bulk ops already in WriteOps (bulk_create_partial / bulk_update_partial / bulk_purge_partial) — no new base primitives.

  • bulk_create(creators: Sequence[Creator[AppConfigFragmentRow]])no write-gate: the FK to the allow-list is the gate, so an item with no allow-list row for its (config_name, scope_type) fails per item as AppConfigFragmentWriteNotAllowed (via the spec's integrity checks), and a duplicate natural key fails likewise. Each insert runs in its own savepoint for partial success.
  • bulk_update(updaters) / bulk_purge(purgers) — likewise no gate: a fragment row exists only while its allow-list entry does (FK with cascade, feat(BA-6704): cascade app config subtree deletion from the definition #12518), so an existing fragment is always writable at its own scope. Missing targets are reported as per-item not-found failures (the generic partial ops silently skip a missing PK).
  • The AppConfigFragmentBulkWriteResult data type (succeeded + failed[index, message]).
  • Repository tests (real DB): partial create with a not-allow-listed item, partial update/purge with a missing target.

📚 Stacked PRs

Part of the AppConfigFragment / AppConfig stack under BEP-1052 (epic BA-5781). Merge in order:

  1. feat(BA-6552): add app_config_fragments DB model and Alembic migration #12306feat(BA-6552): app_config_fragments DB model and Alembic migration
  2. feat(BA-6553): add app_config_fragments repository layer #12307feat(BA-6553): repository layer
  3. refactor(BA-6619): consolidate AppConfigScopeType into common.data (single definition) #12403refactor(BA-6619): consolidate AppConfigScopeType into common.data
  4. refactor(BA-6620): ExistsQuerier ops primitive + AppConfigAllowList.exists #12405refactor(BA-6620): ExistsQuerier + AppConfigAllowList.exists
  5. feat(BA-6554): add app_config_fragment service layer #12358feat(BA-6554): AppConfigFragment service layer
  6. feat(BA-6702): move fragment rank to the allow list with scope defaults #12516feat(BA-6628): move fragment rank to the allow list with scope defaults (replaces feat(BA-6628): conditional-bulk repository primitives #12429)
  7. feat(BA-6701): expose allow-list rank on the v2 API surface #12517feat(BA-6628): expose allow-list rank on the v2 API surface
  8. feat(BA-6704): cascade app config subtree deletion from the definition #12518feat(BA-6628): cascade fragment deletion from the allow list
  9. 👉 feat(BA-6626): app_config_fragment bulk repository layer #12426feat(BA-6626): app_config_fragment bulk repository layer ← you are here
  10. feat(BA-6618): app_config_fragment bulk CRUD service layer #12401feat(BA-6618): AppConfigFragment bulk CRUD service layer
  11. feat(BA-6555): AppConfig merge engine + resolve service (service layer) #12359feat(BA-6555): app_config service layer (merge engine)
  12. feat(BA-6556): AppConfig REST v2 API (raw fragments and merged read/update) #12377feat(BA-6556): AppConfig REST v2 API

📚 Documentation preview 📚: https://sorna--12426.org.readthedocs.build/en/12426/


📚 Documentation preview 📚: https://sorna-ko--12426.org.readthedocs.build/ko/12426/

@github-actions github-actions Bot added size:XL 500~ LoC comp:manager Related to Manager component labels Jun 26, 2026
@jopemachine jopemachine force-pushed the feat/BA-6626-app-config-fragment-bulk-repository branch from cf41d87 to ffa35db Compare June 26, 2026 04:59
jopemachine added a commit that referenced this pull request Jun 26, 2026
Bulk create/update/purge for app_config_fragment at the service layer, on top of the
repository primitives in #12426 (BA-6626):

- Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods,
  and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet).
- Partial-success results (succeeded + failed[index, message]).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread tests/unit/manager/repositories/ops/test_provider.py Outdated
@jopemachine jopemachine force-pushed the feat/BA-6626-app-config-fragment-bulk-repository branch from ffa35db to bcc97bb Compare June 26, 2026 07:12
jopemachine added a commit that referenced this pull request Jun 26, 2026
Bulk create/update/purge for app_config_fragment at the service layer, on top of the
repository primitives in #12426 (BA-6626):

- Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods,
  and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet).
- Partial-success results (succeeded + failed[index, message]).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread changes/12426.feature.md
@jopemachine jopemachine force-pushed the feat/BA-6626-app-config-fragment-bulk-repository branch from bcc97bb to 846bc64 Compare June 26, 2026 07:26
@jopemachine jopemachine changed the title feat(BA-6626): app_config_fragment bulk repository layer & conditional-bulk primitives feat(BA-6626): app_config_fragment bulk repository layer Jun 26, 2026
@jopemachine jopemachine changed the base branch from main to feat/BA-6628-conditional-bulk-primitives June 26, 2026 07:26
@github-actions github-actions Bot added size:L 100~500 LoC and removed size:XL 500~ LoC labels Jun 26, 2026
jopemachine added a commit that referenced this pull request Jun 26, 2026
Bulk create/update/purge for app_config_fragment at the service layer, on top of the
repository primitives in #12426 (BA-6626):

- Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods,
  and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet).
- Partial-success results (succeeded + failed[index, message]).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jopemachine jopemachine force-pushed the feat/BA-6628-conditional-bulk-primitives branch from 87bcc0c to c83c084 Compare June 26, 2026 07:37
@jopemachine jopemachine force-pushed the feat/BA-6626-app-config-fragment-bulk-repository branch from 846bc64 to ef67230 Compare June 26, 2026 07:37
jopemachine added a commit that referenced this pull request Jun 26, 2026
Bulk create/update/purge for app_config_fragment at the service layer, on top of the
repository primitives in #12426 (BA-6626):

- Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods,
  and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet).
- Partial-success results (succeeded + failed[index, message]).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jopemachine jopemachine force-pushed the feat/BA-6628-conditional-bulk-primitives branch from c83c084 to 7cda3f9 Compare June 26, 2026 08:03
@jopemachine jopemachine force-pushed the feat/BA-6626-app-config-fragment-bulk-repository branch from ef67230 to f2316f2 Compare June 26, 2026 08:03
jopemachine added a commit that referenced this pull request Jun 26, 2026
Bulk create/update/purge for app_config_fragment at the service layer, on top of the
repository primitives in #12426 (BA-6626):

- Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods,
  and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet).
- Partial-success results (succeeded + failed[index, message]).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jopemachine jopemachine force-pushed the feat/BA-6628-conditional-bulk-primitives branch from 7cda3f9 to 614eaf0 Compare June 26, 2026 08:12
@jopemachine jopemachine force-pushed the feat/BA-6626-app-config-fragment-bulk-repository branch from f2316f2 to 3462f91 Compare June 26, 2026 08:12
jopemachine added a commit that referenced this pull request Jun 26, 2026
Bulk create/update/purge for app_config_fragment at the service layer, on top of the
repository primitives in #12426 (BA-6626):

- Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods,
  and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet).
- Partial-success results (succeeded + failed[index, message]).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jopemachine jopemachine force-pushed the feat/BA-6628-conditional-bulk-primitives branch from 614eaf0 to 6d69904 Compare June 26, 2026 09:09
@jopemachine jopemachine force-pushed the feat/BA-6626-app-config-fragment-bulk-repository branch from 3462f91 to 14f10a1 Compare June 26, 2026 09:10
@jopemachine jopemachine force-pushed the feat/BA-6628-fragment-cascade branch from 398066c to b8cdd23 Compare July 6, 2026 02:34
@jopemachine jopemachine force-pushed the feat/BA-6626-app-config-fragment-bulk-repository branch from e3d03c1 to 152cfac Compare July 6, 2026 02:34
jopemachine added a commit that referenced this pull request Jul 6, 2026
Bulk create/update/purge for app_config_fragment at the service layer, on top of the
repository primitives in #12426 (BA-6626):

- Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods,
  and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet).
- Partial-success results (succeeded + failed[index, message]).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jopemachine jopemachine force-pushed the feat/BA-6628-fragment-cascade branch 6 times, most recently from 3e1272d to b1e8537 Compare July 6, 2026 07:47
@jopemachine jopemachine force-pushed the feat/BA-6626-app-config-fragment-bulk-repository branch from 152cfac to 0a82ba7 Compare July 6, 2026 08:02
jopemachine added a commit that referenced this pull request Jul 6, 2026
Bulk create/update/purge for app_config_fragment at the service layer, on top of the
repository primitives in #12426 (BA-6626):

- Bulk actions carrying BulkConditional{Creator,Updater,Purger} payloads, service methods,
  and BulkActionProcessor wiring (per-entity RBAC extension point; no validator yet).
- Partial-success results (succeeded + failed[index, message]).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jopemachine jopemachine force-pushed the feat/BA-6628-fragment-cascade branch from b1e8537 to ce15831 Compare July 7, 2026 02:09
Base automatically changed from feat/BA-6628-fragment-cascade to main July 7, 2026 05:21
@jopemachine jopemachine force-pushed the feat/BA-6626-app-config-fragment-bulk-repository branch 6 times, most recently from 801351d to ab3e072 Compare July 7, 2026 05:50
Build the app_config_fragment bulk repository on the conditional-bulk primitives (#12429):

- bulk_create / bulk_update / bulk_purge in db_source + repository, returning
  AppConfigFragmentBulkWriteResult (succeeded + failed[index, message]) — partial
  success via the WriteOps.bulk_*_partial primitives.
- bulk_create takes plain Creators; the FK to the allow-list is the gate, so an item
  with no allow-list row fails per-item as AppConfigFragmentWriteNotAllowed (via the
  spec's integrity checks) while the rest are created.
- Repository unit tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the repository-layer bulk operations (bulk_create / bulk_update / bulk_purge) for app_config_fragment, split out of the bulk service-layer PR (#12401) to keep it reviewable. It builds directly on the generic partial-bulk primitives already in WriteOps (bulk_create_partial / bulk_update_partial / bulk_purge_partial) and introduces no new base primitives. Each item runs in its own savepoint for partial success; failures are reported per item with a batch index and reason. It fits into the AppConfigFragment/AppConfig stack under BEP-1052 as the layer beneath the upcoming bulk CRUD service.

Changes:

  • New AppConfigFragmentBulkWriteResult / AppConfigFragmentBulkItemError data types carrying succeeded + failed[index, message].
  • db_source bulk methods: create relies on the allow-list FK as the per-item gate; update/purge reconstruct missing-target "not found" failures from the base result (missing PKs are silently skipped by the primitive).
  • Real-DB repository tests covering all-success and partial (not-allow-listed create / missing update / missing purge) paths, plus a changelog fragment.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/ai/backend/manager/data/app_config_fragment/types.py Adds the bulk-result and per-item error data types.
src/ai/backend/manager/repositories/app_config_fragment/db_source/db_source.py Implements bulk create/update/purge over the partial ops, mapping successes/errors and reconstructing not-found failures.
src/ai/backend/manager/repositories/app_config_fragment/repository.py Delegates the three bulk methods to the db_source under the repository resilience policy.
tests/unit/manager/repositories/app_config_fragment/test_repository.py Real-DB tests for all-success and partial bulk create/update/purge.
changes/12426.feature.md Changelog fragment describing the bulk repository operations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ai/backend/manager/repositories/app_config_fragment/db_source/db_source.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comment thread changes/12426.feature.md
@@ -0,0 +1 @@
Add `app_config_fragment` bulk repository operations (`bulk_create`/`bulk_update`/`bulk_purge` with per-item partial success): bulk create relies on the allow-list FK so an item with no allow-list row is rejected per item, bulk update/purge report missing targets per item, and the `AppConfigFragmentBulkWriteResult` data type carries the partial result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentations comp:agent Related to Agent component comp:app-proxy Related to App Proxy component comp:cli Related to CLI component comp:client Related to Client component comp:common Related to Common component comp:manager Related to Manager component comp:storage-proxy Related to Storage proxy component comp:webserver Related to Web Server component require:db-migration Automatically set when alembic migrations are added or updated size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants